BDCD Business Analytics Lab exercise

Prof Di Cook, with Steph Kobakian, Stuart Lee, Nick Spyrison

Econometrics & Bus Stat, Monash, Clayton campus, 22/2/2019

Motivation

Be energy-wise, for a greener future. Climate change is consistently in the news. The consequences for Melbourne are more extreme high temperatures and drought. Individuals can play a big role in mitigating the extremes of the future, if they know how their actions contribute to the world as a whole. All of Melbourne households now have smart meters, which report the energy use every 30 minutes.

Task

Business analytics involves mathematics, computing and data. This lab exercise has a little of both. For the coding part, you will want to pretend you are a master cook, fashion designer, computer repairer or motor mechanic: copy, pull apart and put together again.

We will show you how to download the smart meter data for your household, wrangle it into shape, and then how to make plots to explore household energy use. What times of day does the household use the most energy, or time of year? Is it related to the weather, with air conditioner or heater usage, or special events, like washing and drying clothes the night before a holiday trip, or dinner parties with friends. We will compare the usage across different households. All the tools used are open source software that will be available to you into the future.

Getting started

Reading

Point your web browser to this site: https://compare.energy.vic.gov.au. How can you earn $50 from your energy data?

What’s a smart meter? Take a look at the web site http://www.smartmeters.vic.gov.au/# How many smart meters have been installed across Victoria?

Get materials

Materials for the workshop can be downloaded from https://github.com/Monash-BDCD/energy. It will download and unzip onto your computer with the name “energy-master”, by default. Change it to “energy”.

There are several files that will download:

About the data

Data collected by downloading Di’s (and friend of hers) electricity usage data as recorded by the household smart meter. Details on how to do this are (THIS IS ONLY IF YOU WANT TO COLLECT YOUR OWN HOUSEHOLD’S DATA):

Maybe after this workshop, you can do your own household, upload it to the compare suppliers site, claim your $50 (and get your parent to pay you this for your efforts), and possibly get a better deal on household energy costs.

Resources

Cheat sheets are provided for:

Exercise 1: Background work

Read in Di’s energy data. Look at the format of the data, and then rearrange it to a tidier format.

## # A tibble: 10 x 55
##    id    date      d1    d2    d3    d4    d5    d6    d7    d8    d9   d10
##    <chr> <chr>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1 200   meter1    NA    NA    NA    NA    NA    NA    30    NA    NA    NA
##  2 300   20171…     0     0     0     0     0     0     0     0     0     0
##  3 300   20171…     0     0     0     0     0     0     0     0     0     0
##  4 300   20171…     0     0     0     0     0     0     0     0     0     0
##  5 300   20171…     0     0     0     0     0     0     0     0     0     0
##  6 300   20171…     0     0     0     0     0     0     0     0     0     0
##  7 300   20171…     0     0     0     0     0     0     0     0     0     0
##  8 400   1         43    NA    NA    NA    NA    NA    NA    NA    NA    NA
##  9 400   44        44    NA    89    NA    NA    NA    NA    NA    NA    NA
## 10 400   45        48    NA    NA    NA    NA    NA    NA    NA    NA    NA
## # … with 43 more variables: d11 <dbl>, d12 <dbl>, d13 <dbl>, d14 <dbl>,
## #   d15 <dbl>, d16 <dbl>, d17 <dbl>, d18 <dbl>, d19 <dbl>, d20 <dbl>,
## #   d21 <dbl>, d22 <dbl>, d23 <dbl>, d24 <dbl>, d25 <dbl>, d26 <dbl>,
## #   d27 <dbl>, d28 <dbl>, d29 <dbl>, d30 <dbl>, d31 <dbl>, d32 <dbl>,
## #   d33 <dbl>, d34 <dbl>, d35 <dbl>, d36 <dbl>, d37 <dbl>, d38 <dbl>,
## #   d39 <dbl>, d40 <dbl>, d41 <dbl>, d42 <dbl>, d43 <dbl>, d44 <dbl>,
## #   d45 <dbl>, d46 <dbl>, d47 <dbl>, d48 <dbl>, stuff1 <chr>,
## #   stuff2 <chr>, stuff3 <chr>, stuff4 <chr>, stuff5 <chr>

Here’s the wrangling, 🏃‍♀, and new format:

## # A tibble: 15 x 9
##    id    date       halfhour   kwh wday  month  year dt                 
##    <chr> <date>        <dbl> <dbl> <ord> <ord> <dbl> <dttm>             
##  1 300   2017-11-24      0.5     0 Fri   Nov    2017 2017-11-24 12:30:00
##  2 300   2017-11-24      1       0 Fri   Nov    2017 2017-11-24 13:00:00
##  3 300   2017-11-24      1.5     0 Fri   Nov    2017 2017-11-24 13:30:00
##  4 300   2017-11-24      2       0 Fri   Nov    2017 2017-11-24 14:00:00
##  5 300   2017-11-24      2.5     0 Fri   Nov    2017 2017-11-24 14:30:00
##  6 300   2017-11-24      3       0 Fri   Nov    2017 2017-11-24 15:00:00
##  7 300   2017-11-24      3.5     0 Fri   Nov    2017 2017-11-24 15:30:00
##  8 300   2017-11-24      4       0 Fri   Nov    2017 2017-11-24 16:00:00
##  9 300   2017-11-24      4.5     0 Fri   Nov    2017 2017-11-24 16:30:00
## 10 300   2017-11-24      5       0 Fri   Nov    2017 2017-11-24 17:00:00
## 11 300   2017-11-24      5.5     0 Fri   Nov    2017 2017-11-24 17:30:00
## 12 300   2017-11-24      6       0 Fri   Nov    2017 2017-11-24 18:00:00
## 13 300   2017-11-24      6.5     0 Fri   Nov    2017 2017-11-24 18:30:00
## 14 300   2017-11-24      7       0 Fri   Nov    2017 2017-11-24 19:00:00
## 15 300   2017-11-24      7.5     0 Fri   Nov    2017 2017-11-24 19:30:00
## # … with 1 more variable: work <chr>

Exercise 2: Plot (some of) the data in a calendar layout

Exercise 4: Combine with weather data

Making an interactive plot

Exercise 5: Your turn to code

  1. Easy tasks:
    1. XXX
    2. XXX
  2. Medium task:
    1. XXX
    2. XXX
    3. XXX
  3. Difficult: Make a new app to study XXX. The steps to do this are:
    1. XXX
    2. XXX
    3. XXX

With your new app, XXX

Turn in

Each group needs to provide to the instructor:

  1. A document with answers to each of the questions
  2. A copy of your app code